Warming Up

Here are some CLUE calisthenics to limber you up. Some of them will require further study of CLUE, CLX, and the X Window System. Some of them are rather challenging.

  1. Complete the blinker contact example. Write a display method that will fill the blinker with its color when its on-p state is true and fill it with its background otherwise. Ensure that the blinker-on-p accessor updates the display correctly.

  2. Create two blinker instances — one that will print out either ``Off!'' when its :blink callback is called with a nil argument or ``On!'' otherwise, and another which will make a funny noise on your Explorer only when its :blink callback is called with a non-nil argument.

  3. Try out different contact attributes on your blinker. For example, try a different border-width, border, and background. Try initializing the background to a '(float 0 1) value. What happened? Why?

  4. Define resources to change initial blinker attributes.

  5. Create two ``funny noise'' blinker instances, as in the previous exercise, but give them different funny noises. Do not change the definition of the blinker class.

  6. Change the blinker class so that whenever the cursor enters a blinker, it turns into a picture of Gumby. Hint: use the xfd program (font displayer) to find an appropriate element of the cursor font. Another hint: Use ``man xfd'' to learn how to use xfd.

  7. Change the blinker class to include a string slot, containing a string which can be displayed in any font. Display the string so that it appears in the blinker's color, is centered horizontally and vertically within the blinker's current interior size, and is visible regardless of the blinker's on-p state. Ensure that the string remains centered when the user changes the font or the size of the blinker.

  8. Define a composite class that always has a single blinker child, which is always centered horizontally and vertically within the composite. Ensure that the blinker child remains centered when the user changes the size of the composite.

  9. Define an etch-a-sketch contact that will: